package springbootorderrabbitmqproducer.demo.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.*;

/**
 * @ClassName DeadMqConfiguration
 * @Date 2021/6/9 0009 上午 10:52
 * @Author Administrator
 * @Description 死性队列
 * Version 1.0
 */
@Configuration
public class DeadMqConfiguration {


    String exchangeName = "dead_direct_exchange";

    String deadQueue = "dead_direct_queue";

    @Bean
    public DirectExchange deadDirectExchange() {
        return new DirectExchange(exchangeName, true, false);
    }


    // 死信队列  过期之后存放队列
    @Bean
    public Queue deadDirectQueue() {
        return new Queue(deadQueue, true);
    }


    @Bean
    public Binding deadSmsDirectBinding() {
        return BindingBuilder.bind(deadDirectQueue()).to(deadDirectExchange()).with("dead");
    }

}
